let mixin = {
  props: {

  },
  mounted() {

  },
  data() {
    return {
      nengxiaods: [],
    }
  },
  watch: {
    '$store.state.daping.efficiency.g_data_arr': {
      handler: function (n, o) {
        var entities = {}
        for (
          let index = 0;
          index < this._viewer.dataSources.length;
          index++
        ) {
          if (this.ds[0] == this._viewer.dataSources.get(index)._name) {
            entities = this._viewer.dataSources.get(index).entities.values
          }
        }

        for (var o = 0; o < entities.length; o++) {
          var entity = entities[o];
          if (entity.polygon != undefined) {
            let rescolor = this.getefficcolor(n, entity.id, this.$store.state.daping.efficiency.type, this.$store.state.daping.efficiency.colorvalmap, this.$store.state.daping.efficiency.colors)
            entity.polygon.stroke = Cesium.Color.fromCssColorString(rescolor);
            entity.polygon.material = Cesium.Color.fromCssColorString(rescolor);
            entity.polygon.strokeWidth = 5;

          }
        }
      }
    }
  },

  methods: {
    nengxiao() {
      let _this = this;
      var viewer = this._earth.czm.viewer;
      let geos = ["efficiency.json"];
      geos.map(item => {
        var promise = Cesium.GeoJsonDataSource.load("/geojson/" + item);
        promise.then(function (dataSource) {
          viewer.dataSources.add(dataSource);
          _this.ds.push(dataSource._name)
        });
      });
    }
  }
}

export default mixin